<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Details mondat</title>


<!---------------------for autocomplete--------------->
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-1.11.0.min.js');?>" ></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js');?>" ></script>
	<link href="<?php echo base_url("assets/css/jquery-ui.css")?>" rel="stylesheet" type="text/css" />
<!---------------------for form css ----------------------->
	<link href="<?php echo base_url("assets/css/pure.css")?>" rel="stylesheet" type="text/css" />
<!---------------------for form validation ----------------------->
<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.validate.js');?>" ></script>
<!---------------------for form mask input ----------------------->
<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.mask.min.js');?>" ></script>

 <link href="<?php echo base_url("assets/css/botton.css")?>" rel="stylesheet" type="text/css" />
 
</head>
<body>
<?php
include_once('header.php');

// ----- populate $liste_des_fournisseurs array for autocomplete ----- //

// ----- populate $liste_des_activites array for autocomplete ----- //

?>
<?php
echo form_open_multipart( base_url('mondat_ctr/valider_accord_cf').'/'.$id_mandat ); 

 $today = getdate();
 $date=$today['year'].'-'.$today['mon'].'-'.$today['mday'];
			

?>

<form id="fournisseur_frm" class="pure-form pure-form-stacked" method="POST" action="<?php echo base_url('mondat_ctr/valider_accord_cf').'/'.$id_mandat ;?>">
    <fieldset>
        <legend>اضافة تاشيرة المراقب المالي</legend>

        <div class="pure-g">
            
            <div class="pure-u-1 pure-u-md-1-3 ">
                <label for="numero"> رقم التأشيرة</label>
				<input class="ltr" id="visa_cf" name="visa_cf" type="text" value=" 0 ">
                
            </div>

           
			
			<div class="pure-u-1 pure-u-md-1-3">
                <label for="address">التاريخ </label>
                <input id="date" name="date" type="text" value="<?php echo($date);?>">
            </div>
			
			
			
        </div>
      <?php
 
echo ('<a href="'. base_url('mondat_ctr/').'" class="pure-button pure-button-primary">خروج</a>
<input type="submit" value="اضافة"  class="pure-button pure-button-primary" />
');
?>
     
    </fieldset>
</form>

</body>
<script>


//---

$('#submit_btn').click(function() {
  if($("[class^=error]").is(":visible")){
    alert('منالك حقل / حقول إدخال غير مطابقة !');
    return false;
  } else {
  	$('#fournisseur_frm').submit();
    return false;
  }
});

$('#visa_cf').bind('mouseup keyup focusout focus mousemove',function() {
    $('span.error-rc').hide();
	$(this).css('background-color','pink');
    var inputVal = $(this).val();
    var characterReg = /^([a-zA-Z0-9,-\/]{1,25})$/;
   // var characterReg = /^([0-9]{2}\/[0-9]{2}-[0-9]{5,9}[a-zA-Z][0-9]{2})$/;
	
    if(!characterReg.test(inputVal)) {
        $(this).after('<span class="error-rc" flag="required" style="color:red;" >حقل غير مطابق للشكل العام </span>');
    }else{
		$(this).css('background-color','#FFFFFF');
	}
});

$('#date').bind('mouseup keyup focusout focus mousemove',function() {
    $('span.error-rc').hide();
	$(this).css('background-color','pink');
    var inputVal = $(this).val();
    var characterReg = /^([0-9]{4,4}-[0-9]{2,2}-[0-9]{2,2})$/;
   // var characterReg = /^([0-9]{2}\/[0-9]{2}-[0-9]{5,9}[a-zA-Z][0-9]{2})$/;
	
    if(!characterReg.test(inputVal)) {
        $(this).after('<span class="error-rc" flag="required" style="color:red;" >حقل غير مطابق للشكل العام </span>');
    }else{
		$(this).css('background-color','#FFFFFF');
	}
});


//---* maskage below 
$('#numero').mask('AAA', {'translation': {
                                        A: {pattern: /[0-9]/},
										O: {pattern: /[0-9]/, optional: true},
										D: {pattern: /[a-zA-Z]/}
                                      }
                                });

//---* maskage below 
$('#mondat').mask('AAA', {'translation': {
                                        A: {pattern: /[0-9]/},
										O: {pattern: /[0-9]/, optional: true},
										D: {pattern: /[a-zA-Z]/}
                                      }
                                });





</script>
</html>